package com.polytech.tests;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

import com.polytech.beans.Brand;
import com.polytech.beans.Car;
import com.polytech.beans.Category;
import com.polytech.beans.Model;
import com.polytech.ihm.ConnexionFrame;
import com.polytech.ihm.FrameAddCar;
import com.polytech.ihm.FrameClient;
import com.polytech.ihm.PanelAd;
import com.polytech.models.CarsModel;
import com.polytech.utils.BusinessFactory;

public class Main  extends JFrame{
	JPanel panelMain=new JPanel(new BorderLayout());
	private JList<Car> listAds ;
	private CarsModel cars=new CarsModel();
	public Main() {
		cars.addCars(BusinessFactory.getCarsManager().getCars());
		listAds=new JList<>(cars);
		JScrollPane scroll=new JScrollPane(listAds);
		
		panelMain.add(BorderLayout.CENTER, scroll);
		
		listAds.setCellRenderer(new PanelAd());
		this.setContentPane(panelMain);
		this.setVisible(true);
		this.setBounds(0, 0, 400, 800);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	
		
	}


	
	public static void main(String[] args) {
		new ConnexionFrame();
	}

}
